//
//  TipView.m
//  兼职页面
//
//  Created by kuiyuan liang on 2021/5/23.
//

#import "TipView.h"
#import "CommonUtil.h"
@interface TipView()

@property (strong, nonatomic) UILabel * tipLabel;
@property (strong, nonatomic) UIButton * vipBtn;

@end

@implementation TipView


-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        self.layer.cornerRadius = AD(5);
        [self addSubview:self.tipLabel];
        [self addSubview:self.vipBtn];
    }
    return self;
}

- (void)update:(UIButton *)sender{
    NSLog(@"升级vip");
}

-(UILabel *)tipLabel{
    if (!_tipLabel) {
        _tipLabel = [[UILabel alloc] initWithFrame:CGRectMake(AD(5), 0, self.width-AD(10), AD(100))];
        _tipLabel.textColor = [UIColor lightGrayColor];
        _tipLabel.text = @"1.本期统计结果,成为年费VIP用户即可观看。\n2.成为年费VIP后其他榜单统计结果皆可查看。\n本结果仅统计当期[上榜用户]战绩（包含收费战绩，未上榜用户不加入统计）。\n4.当前数据来源均来自彩民之家,仅供参考！";
        _tipLabel.font = [UIFont systemFontOfSize:AD(13)];
        _tipLabel.numberOfLines = 0;
    }
    return _tipLabel;
}

-(UIButton *)vipBtn{
    if (!_vipBtn) {
        _vipBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_vipBtn setTitle:@"升级VIP" forState:UIControlStateNormal];
        [_vipBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _vipBtn.titleLabel.font = [UIFont boldSystemFontOfSize:AD(15)];
        _vipBtn.backgroundColor = RGB(236.0, 92.0, 77.0);
        _vipBtn.layer.cornerRadius = AD(5);
        _vipBtn.clipsToBounds = YES;
        _vipBtn.frame = CGRectMake(AD(5), _tipLabel.bottom, _tipLabel.width, AD(30));
        [_vipBtn addTarget:self action:@selector(update:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return _vipBtn;
}

@end
